package org.obi.task

import org.obi.attr.SrcDir

/**
 * The javac tool reads class and interface definitions, written in the Java programming language, and compiles them into bytecode class files.
 * More information can be found on the following links:
 * <ul>
 * <li><a href="http://java.sun.com/javase/6/docs/technotes/tools/solaris/javac.html">Java programming language compiler</a>
 * <li><a href="http://ant.apache.org/manual/CoreTasks/javac.html">Javac Ant Task</a>
 * </ul>
 */
sealed trait Javac {
    // Tom: Write more apply's here, to handle different attributes, files, etc.
    def apply(srcdir: SrcDir): Javac = this match {
        case Javac_(_) => Javac_(Some(srcdir))
    }

    def srcdir(s: String) = apply(SrcDir.srcdir(s))

    def srcdir = this match {
        case Javac_(s) => s
    }
}

private final case class Javac_(s: Option[SrcDir]) extends Javac

object Javac {
    /**
     * Creates a new Java compiler.
     */
    def javac: Javac = Javac_(None)
}
